from pod.std import *
import math
import operator

class EqualsStatement(Macro):
    name = "eq"
    
    def __init__(self, ctx, a, b):
        super(EqualsStatement, self).__init__()
        self.condition = (a == b)        
    
    def __call__(self, content):
        return self.condition
        
class Multiply(Macro):
    name = "mul"
    
    def __init__(self, ctx, a, b):
        super(Multiply, self).__init__()        
        self.operands = (a, b)
        
    def __call__(self, content):
        return operator.__mul__(*self.operands)
        
class Divide(Macro):
    name = "div"
    
    def __init__(self, ctx, a, b):
        super(Divide, self).__init__()
        self.operands = (a, b)
        
    def __call__(self, content):
        return operator.__div__(*self.operands)
        
class Add(Macro):
    name = "add"
    
    def __init__(self, ctx, a, b):
        super(Add, self).__init__()
        self.operands = (a, b)
    
    def __call__(self, content):
        return operator.__add__(*self.operands)

class Sub(Macro):
    name = "sub"

    def __init__(self, ctx, a, b):
        super(Sub, self).__init__()
        self.operands = (a, b)

    def __call__(self, content):
        return operator.__sub__(*self.operands)
        
class Pow(Macro):
    name = "pow"
    
    def __init__(self, ctx, a, b):
        super(Pow, self).__init__()
        self.operands = (a, b)
        
    def __call__(self, content):
        return operator.__pow__(*self.operands)
        
class Sine(Macro):
    name = "sin"
    
    def __init__(self, ctx, value):
        super(Sine, self).__init__()
        self.value = value
    
    def __call__(self, content):
        return math.sin(self.value*math.pi/180.0)
        
class Cosine(Macro):
    name = "cos"
    
    def __init__(self, ctx, value):
        super(Cosine, self).__init__()
        self.value = value
        
    def __call__(self, content):
        return math.cos(self.value*math.pi/180.0)

class Modulus(Macro):
    name = "mod"
    
    def __init__(self, ctx, a, b):
        super(Modulus, self).__init__()
        self.operands = (a, b)
    
    def __call__(self, content):
        return operator.mod(*self.operands)